#ifndef __FORWARD_BUFFER_H_INCLUDED__
#define __FORWARD_BUFFER_H_INCLUDED__

#ifdef __cplusplus
extern "C" {
#endif

class forward_buffer{

public:

	forward_buffer();

	~forward_buffer();

	void alloc(unsigned int alloc_size = 1024);

	bool is_valid();

	void zero();

	void release();

	unsigned int get_buffer_len();

	char* get_data_ptr();

	unsigned int get_data_len();

	void write(char* ptr, unsigned int len);

	void erase_front(unsigned int len);

private:

	char* buffer_ptr;

	unsigned int buffer_len;

	unsigned int start_pos;

	unsigned int end_pos;

};

#ifdef __cplusplus
}
#endif

#endif // __FORWARD_BUFFER_H_INCLUDED__
